<template>
  <div>
    <ul>
      <li v-for="(item, index) in arr" :key="index">
        <span>{{ item }}</span>
        <button @click="rem(index)">删除</button>
      </li>
    </ul>
    <button @click="add">生成</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr: [],
    };
  },
  methods: {
    add() {
      this.arr.push(Math.floor(Math.random() * 51 + 50));
    },
    rem(i) {
      this.arr.splice(i, 1);
    },
  },
};
</script>

<style></style>
